$(function() {
	let arrTrType = new Array("", "自由行", "纯玩团");
	let jsonTrArrs = [{
			"trName": "成都市内亲子游",
			"trType": 1,
			"trPrice": "200.00",
			"trPhone": "13574556682",
			"trUser": "章若阳",
			"createTime": "2021-08-07"
		},
		{
			"trName": "峨眉山＋九寨沟轻松游",
			"trType": 2,
			"trPrice": "500.00",
			"trPhone": "16833556681",
			"trUser": "孙媚",
			"createTime": "2021-08-05"
		},
		{
			"trName": "都江堰＋青城山一日游",
			"trType": 1,
			"trPrice": "100.00",
			"trPhone": "18774556690",
			"trUser": "王释晖",
			"createTime": "2021-08-04"
		}
	];
	let $TrStr = "";
	$(jsonTrArrs).each(function(index) {
		let arrJson = jsonTrArrs[index];
		$TrStr += `<tr>
						<td>${arrJson.trName}</td>
						<td>${arrTrType[arrJson.trType]}</td>
						<td>${arrJson.trPrice}</td>
						<td>${arrJson.trPhone}</td>
						<td>${arrJson.trUser}</td>
						<td>${arrJson.createTime}</td>
						<td>
							<a href="">详情</a>
							<a href="javascript:void(0);" class="del">删除</a>
						</td>
					</tr>`
	});
	$("tbody").html($TrStr);
	// 使用jQuery动态删除数据
	$(".del").click(function(){
		if (confirm("确认删除当前数据吗?")) {
			$(this).parent().parent().remove();
		}
	});
	$("#submit button:first").click(function(){
		var $buttons = $("[name='input']");
		$buttons.each(function(i){
			if ($($buttons[i]).val()=='') {
				alert("请填写完整的用户信息!!!")
			}
		})
	})
	
});
